import React, { Component } from 'react';
import './detail-title.css';
import { BrowserRouter as Router, Route, Link, Switch} from 'react-router-dom';

class Title extends Component {


    render() {

        let name = this.props.name;
        let img = this.props.img;
        let price = this.props.price;
        let vipPrice = this.props.vipPrice

        if(price === '0.00' || price === 0){
            price = '免费';
        }

        if(vipPrice === '0.00' || vipPrice === 0){
            vipPrice = '免费';
        }

        return (
            <div className="detail-title">
                <Link to="/">
                    <i className="icon iconfont icon-back_light detail-back"></i>
                </Link>
                <div className="cover-box">
                    <img src={img}  alt="" />
                </div>
                <span className="title-page-name span-left">{name}</span>
                <span className="span-left title-page-count">总计55题目</span>
                <div className="buy-button buy-common">
                    价格:{price}
                </div>
                <div className="buy-button buy-vip">
                    会员:{vipPrice}
                </div>
            </div>
        );
    }
}

export default Title;